package com.cy.personer.biz.impl;

import com.cy.personer.bean.Suggest;
import com.cy.personer.bean.Summary;
import com.cy.personer.biz.SummaryBiz;
import com.cy.personer.ceptor.OperationLog;
import com.cy.personer.mapper.SummaryMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

//总结
@Service
public class SummaryBizImpl implements SummaryBiz {


    /**
     * 新增总结
     * @author 林少艺
     */
    @Resource
    SummaryMapper summaryMapper;

    @OperationLog(operType="添加",methods = "填写报告总结" )
    @Override
    public boolean addSummary(Summary summary) {
        return summaryMapper.addSummary(summary)>0;
    }

    /**
     * 修改总结
     * @param summary
     * @return
     * @author 林少艺
     */
    @OperationLog(operType="修改",methods = "修改报告总结" )
    @Override
    public boolean updateSummary(Summary summary) {
        return summaryMapper.updateSummary(summary)>0;
    }


    /**
     * 查询总结列表
     * @author 林少艺
     */
    @Override
    public PageInfo<Summary> getSummarys(Summary summary, int pageNum) {
        Page<Summary> page = PageHelper.startPage(pageNum,5);
        summaryMapper.getSummarys(summary);
        PageInfo<Summary> pageInfo = new PageInfo<>(page);
        return pageInfo;
    }

    /**
     * 查找总结列表
     * @param summary
     * @return
     * @author 林少艺
     */
    @Override
    public Summary getSummary(Summary summary) {
        return summaryMapper.getSummary(summary);
    }

    /**
     * 删除总结
     * @param summary
     * @return
     * @author 林少艺
     */
    @OperationLog(operType="删除",methods = "删除报告总结" )
    @Override
    public boolean delSummary(Summary summary) {
        return summaryMapper.delSummary(summary)>0;
    }
}
